package com.rjpacket.supernews.app.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.rjpacket.supernews.app.R;

import java.util.List;

/**
 * Created by Administrator on 2015/3/15 0015.
 */
public class SearchDetailAdapter extends BaseAdapter {
    private List<String> list;
    private Context context;

    public SearchDetailAdapter(List<String> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View ret = null;

        if (view != null) {
            ret = view;
        } else {
            ret = LayoutInflater.from(context).inflate(R.layout.item_search_news_detail, viewGroup, false);
        }

        ViewHolder holder = (ViewHolder) ret.getTag();
        if (holder == null) {
            holder = new ViewHolder();
            holder.title = (TextView) ret.findViewById(R.id.search_txt_3);
            ret.setTag(holder);
        }

        holder.title.setText(list.get(i));
        return ret;
    }

    private class ViewHolder {
        private TextView title;
    }
}
